<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>招标发布</title>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/index.css}" rel="stylesheet"/>
    <link th:href="@{/css/tool.css}" rel="stylesheet"/>
    <link th:href="@{/css/easyeditor.css}" rel="stylesheet"/>

    <!-- 图标  -->
    <link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_1531710_xb357ub1wmg.css"/>
    <script th:src="@{/layui/layui.js}"  type="text/javascript"></script>
    <script th:src="@{/js/marked.min.js}"  type="text/javascript"></script>
</head>
<body>
<!--<div th:insert="~{navigation::nav}"></div>-->
<div th:if="${msg!=null}">
    <input type="hidden" id="msg" th:value="${msg}">
</div>

<div class="layui-fluid main">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-lg9">
            <h1>招标项目填写</h1>
            <hr>
            <form class="layui-form" action="/publish" method="post">
                <input type="hidden" th:value="${zbInfo?.id}" name="id">
                <input type="hidden" th:value="${session.user.id}" name="userId">
                <input type="hidden" name="fileId" id="fileId" th:value="${zbInfo?.fileId}">
                <input type="hidden" name="scoreDetailFileId" id="scoreDetailFileId" th:value="${zbInfo?.scoreDetailFileId}">
                <div class="layui-form-item">
                    <label class="layui-form-label">项目名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" required lay-verify="required" placeholder="请输入项目名称"
                               autocomplete="off"
                               class="layui-input" th:value="${zbInfo?.title}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">企业名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="companyName" required lay-verify="required" placeholder="请企业名称"
                               autocomplete="off"
                               class="layui-input" th:value="${zbInfo?.companyName}">
                    </div>
                </div>
                <div class="layui-form-item" style="width: 235px;">
                    <label class="layui-form-label">项目类型</label>
                    <div class="layui-input-block">
                        <select name="type" lay-filter="aihao">
                            <option value="" ></option>
                            <option value="类型1" th:selected="${zbInfo?.type=='类型1'}">类型1</option>
                            <option value="类型2" th:selected="${zbInfo?.type=='类型2'}">类型2</option>
                            <option value="类型3" th:selected="${zbInfo?.type=='类型3'}">类型3</option>
                            <option value="类型4" th:selected="${zbInfo?.type=='类型4'}">类型4</option>
                        </select>
                    </div>
                </div>


                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">项目描述</label>
                    <div class="layui-input-block">
                        <textarea id="L_content" name="content" style="" required lay-verify="required"
                                  placeholder="请按照右侧描述填写项目信息" class="layui-textarea editor" th:text="${zbInfo?.content}"></textarea>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">投标人资格要求</label>
                    <div class="layui-input-block">
                        <textarea name="tbRequired" lay-verify="required" placeholder="请按照右侧描述填写项目信息"
                                  class="layui-textarea editor" th:text="${zbInfo?.tbRequired}"></textarea>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">招标文件的获取</label>
                    <div class="layui-input-block">
                        <textarea name="zbFileGet" lay-verify="required" placeholder="请按照右侧描述填写项目信息"
                                  class="layui-textarea editor" th:text="${zbInfo?.zbFileGet}"></textarea>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">投标文件的递交</label>
                    <div class="layui-input-block">
                        <textarea name="tbFilePut" lay-verify="required" placeholder="请按照右侧描述填写项目信息"
                                  class="layui-textarea editor" th:text="${zbInfo?.tbFilePut}"></textarea>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">联系方式</label>
                    <div class="layui-input-block">
                        <textarea name="contact" lay-verify="required" placeholder="请按照右侧描述填写项目信息"
                                  class="layui-textarea editor" th:text="${zbInfo?.contact}"></textarea>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">开始时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="projectStartTime" id="startTime" lay-verify="required"
                               placeholder="yyyy-MM-dd HH:mm:ss"
                               autocomplete="off" class="layui-input" th:value="${#dates.format(zbInfo?.projectStartTime,'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">截至时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="projectEndTime" id="endTime" lay-verify="required"
                               placeholder="yyyy-MM-dd HH:mm:ss"
                               autocomplete="off" class="layui-input" th:value="${#dates.format(zbInfo?.projectEndTime,'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">开标时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="openTime" id="openTime" lay-verify="required"
                               placeholder="yyyy-MM-dd HH:mm:ss"
                               autocomplete="off" class="layui-input" th:value="${#dates.format(zbInfo?.openTime,'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">标书投递截至时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="filePutEndTime" id="filePutEndTime" lay-verify="required"
                               placeholder="yyyy-MM-dd HH:mm:ss"
                               autocomplete="off" class="layui-input" th:value="${#dates.format(zbInfo?.filePutEndTime,'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">答疑截至时间</label>
                    <div class="layui-input-inline">
                        <input type="text" name="answerEndTime" id="answerEndTime" lay-verify="required"
                               placeholder="yyyy-MM-dd HH:mm:ss"
                               autocomplete="off" class="layui-input" th:value="${#dates.format(zbInfo?.answerEndTime,'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>

                <div class="layui-form-item marginTop15px">
                    <label class="layui-form-label">招标文件</label>
                    <div class="layui-upload">
                        <button type="button" class="layui-btn layui-btn-normal" id="fileChoose">选择文件</button>
                        <button type="button" class="layui-btn" id="fileUpload">开始上传</button>
                    </div>
                </div>
<!--                评分细则-->
                <div class="layui-form-item marginTop15px">
                    <label class="layui-form-label">评分细则</label>
                    <div class="layui-upload">
                        <button type="button" class="layui-btn layui-btn-normal" id="scoreDetailFileChoose">选择文件</button>
                        <button type="button" class="layui-btn" id="scoreDetail">开始上传</button>
                    </div>
                </div>

                <div class="layui-form-item marginTop15px">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="sub">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-col-lg3">
            <h1>填写注意点</h1>
            <hr>
            <h4>1.可以使用markdown语法来编写相应内容。</h4>
            <h4>2.可以打开小眼睛来开启实时预览。</h4>
            <h4>3.按照《招表项目表填写办法》填写。</h4>
        </div>
    </div>
</div>

<script type="text/javascript">

    layui.config({base: '/js/mods/'}).extend({
        easyeditor: 'easyeditor'
    });

    layui.use(['form', 'laydate', 'upload', 'element', 'jquery', 'easyeditor','layer'], function () {
        var form = layui.form
            , laydate = layui.laydate
            , upload = layui.upload
            , $ = layui.jquery
            , easyeditor = layui.easyeditor
            ,layer = layui.layer;

        layer.ready(function () {
            // $('#zb').trigger('click');
            if($("#msg").val() == "资格审核中，请耐心等待"){
                layer.msg("资格审核中，请耐心等待", {
                    time: 5000000, //20s后自动关闭)
                })
            }
            else if($("#msg").val() != null){
                layer.confirm($("#msg").val(), {
                    btn: ['前往上传','知道了'] //按钮
                }, function(){
                    location.href = '/zbAddSectionJump'
                }, function(){

                });
            }
        })
        //markdown 初始化
        easyeditor.init({
            elem: '.editor' //textarea 元素class
            , uploadUrl: '/upload' //图片上传地址
            , videoUploadUrl: '/upload' //视频上传地址
            , videoUploadSize: '102400' //限制的上传大小 单位kb 默认 10240 kb
            , uploadSize: '' //限制的上传大小 单位kb 默认 1024k
            //,codeSkin:'notepad' //代码框样式 默认不填 与notepad
            //,style:'fange' //内置样式  目前只有默认 和 方格两种
            //,buttonColor:'#FFB800' //自定义按钮颜色
            //,hoverBgColor:'red'  // 自定义鼠标悬浮背景颜色
            //,hoverColor:'#000000' // 自定义鼠标悬浮按钮颜色
        });

        //日期控件绑定
        laydate.render({
            elem: '#openTime',
            type: 'datetime',
            trigger: 'click'
        });
        laydate.render({
            elem: '#endTime',
            type: 'datetime',
            trigger: 'click'
        });
        laydate.render({
            elem: '#startTime',
            type: 'datetime',
            trigger: 'click'
        });
        laydate.render({
            elem: '#filePutEndTime',
            type: 'datetime',
            trigger: 'click'
        });
        laydate.render({
            elem: '#answerEndTime',
            type: 'datetime',
            trigger: 'click'
        });

        //选完文件后不自动上传
        upload.render({
            elem: '#fileChoose'
            , url: '/file/upload/1' //招标上传接口
            , auto: false
            , accept: 'file'
            //,multiple: true
            , bindAction: '#fileUpload'
            , done: function (res) {
                if (res.code == 200) {
                    layer.msg('上传成功');
                    $('#fileId').val(res.fileId);
                }
                console.log(res)
            }
        });

        //选完文件后不自动上传
        upload.render({
            elem: '#scoreDetailFileChoose'
            , url: '/file/upload/4' //招标上传接口
            , auto: false
            , accept: 'file'
            //,multiple: true
            , bindAction: '#scoreDetail'
            , done: function (res) {
                if (res.code == 200) {
                    layer.msg('上传成功');
                    $('#scoreDetailFileId').val(res.fileId);
                }
                console.log(res)
            }
        });
        form.on('submit(sub)',function () {
            layer.msg("项目提交成功，招标员审核之后将会发布招标公告")
        })


        form.render();
    });
</script>
</body>
</html>